import java.util.Scanner;

public class PasswordError {
    //如果输错了三次密码就结束。输对了密码也结束
    public static void main(String[] args) {
        System.out.println("请输入你的密码");
        int count = 0;
        String num = "123456";
        Scanner sc = new Scanner(System.in);
        while (count < 3) {
            String password = sc.next();
            if (!password.equals(num)) {
                count++;
                if (count == 3) {
                    System.out.println("你输错了3次密码，账号冻结");
                } else {
                    System.out.println("你现在输错了" + count + "次密码还有"+(3-count)+"次机会,请重新输入");
                }
            } else {
                System.out.println("密码正确");
                break;
            }
        }
        sc.close();
    }
}
